package com.hl.controller;

import com.hl.domain.Heartexpert;
import com.hl.domain.Psychologyknowledge;
import com.hl.service.HeartexpertService;
import com.hl.service.serviceImpl.HeartexpertServiceImpl;
import com.hl.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//心理专家
@RequestMapping("/heartExpert")
@RestController
public class HeartexpertController {

    @Autowired
    private HeartexpertService heartexpertService;

//    查询所有
    @GetMapping("/selectAll")
    public R selectAll(){
        return R.success(heartexpertService.selectAll());
    }

//    根据Id查询
    @GetMapping("/selectById")
    public R selectById(Long id){
        return R.success(heartexpertService.selectById(id));
    }
//    根据name查询
    @GetMapping("/selectByName")
    public R selectByName(String name){
        return R.success(heartexpertService.selectByName(name));
    }

//    模糊查询
    @GetMapping("/selectLike")
    public R selectLike(String title){
        return R.success(heartexpertService.selectLike(title));
    }

//    新增
    @PostMapping("/insert")
    public R insert (Heartexpert heartexpert){
        return R.success(heartexpertService.insert(heartexpert));
    }
    //    删除
    @DeleteMapping("/delete")
    public R delete(Long id){
        return R.success(heartexpertService.delete(id));
    }

    //    修改
    @PostMapping("/update")
    public R update(Heartexpert heartexpert){
        return R.success(heartexpertService.update(heartexpert));
    }








}
